<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <!--
                                Charisma v1.0.0
                
                                Copyright 2012 Muhammad Usman
                                Licensed under the Apache License v2.0
                                http://www.apache.org/licenses/LICENSE-2.0
                
                                http://usman.it
                                http://twitter.com/halalit_usman
        -->
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Secret&aacute;ria</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <meta name="description"
                  content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
                <meta name="author" content="Muhammad Usman">

                    <!-- The styles -->
                    <link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
                        <style type="text/css">
                            body {
                                padding-bottom: 40px;
                            }

                            .sidebar-nav {
                                padding: 9px 0;
                            }
                        </style>
                        <link href="css/bootstrap-responsive.css" rel="stylesheet" />
                        <link href="css/charisma-app.css" rel="stylesheet" />
                        <link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
                        <link href='css/fullcalendar.css' rel='stylesheet' />
                        <link href='css/fullcalendar.print.css' rel='stylesheet' media='print' />
                        <link href='css/chosen.css' rel='stylesheet' />
                        <link href='css/uniform.default.css' rel='stylesheet' />
                        <link href='css/colorbox.css' rel='stylesheet' />
                        <link href='css/jquery.cleditor.css' rel='stylesheet' />
                        <link href='css/jquery.noty.css' rel='stylesheet' />
                        <link href='css/noty_theme_default.css' rel='stylesheet' />
                        <link href='css/elfinder.min.css' rel='stylesheet' />
                        <link href='css/elfinder.theme.css' rel='stylesheet' />
                        <link href='css/jquery.iphone.toggle.css' rel='stylesheet' />
                        <link href='css/opa-icons.css' rel='stylesheet' />
                        <link href='css/uploadify.css' rel='stylesheet' />

                        <!-- JqGrig -->
                        <link rel="stylesheet" type="text/css" media="screen"
                              href="jqGrid/css/ui.jqgrid.css" />
                        <!------------>

                        <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
                        <!--[if lt IE 9]>
                                                          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
                                                        <![endif]-->

                        <!-- The fav icon -->
                        <link rel="shortcut icon" href="img/favicon.ico">

                            </head>

                            <body>
                                <!-- topbar starts -->
                                <div class="navbar">
                                    <div class="navbar-inner">
                                        <div class="container-fluid">
                                            <a class="btn btn-navbar" data-toggle="collapse"
                                               data-target=".top-nav.nav-collapse,.sidebar-nav.nav-collapse">
                                                <span class="icon-bar"></span> <span class="icon-bar"></span> <span
                                                    class="icon-bar"></span>
                                            </a> <a class="brand" href="secretaria.html"><span>Secret&aacute;ria</span></a>

                                            <!-- theme selector starts -->
                                            <div class="btn-group pull-right theme-container">
                                                <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                                                    <i class="icon-tint"></i><span class="hidden-phone">
                                                        Alterar Cor</span> <span class="caret"></span>
                                                </a>
                                                <ul class="dropdown-menu" id="themes">
                                                    <li><a data-value="classic" href="#"><i
                                                                class="icon-blank"></i> Padrão</a></li>
                                                    <li><a data-value="cerulean" href="#"><i
                                                                class="icon-blank"></i> Azul Claro</a></li>
                                                    <li><a data-value="cyborg" href="#"><i class="icon-blank"></i>
                                                            Preto</a></li>
                                                    <li><a data-value="redy" href="#"><i class="icon-blank"></i>
                                                            Vermelho</a></li>
                                                    <li><a data-value="journal" href="#"><i
                                                                class="icon-blank"></i> Branco</a></li>
                                                    <li><a data-value="simplex" href="#"><i
                                                                class="icon-blank"></i> Simples</a></li>
                                                    <li><a data-value="slate" href="#"><i class="icon-blank"></i>
                                                            Cinza Escuro</a></li>
                                                    <li><a data-value="united" href="#"><i class="icon-blank"></i>
                                                            Laranja</a></li>
                                                </ul>
                                            </div>
                                            <!-- theme selector ends -->

                                            <!-- user dropdown starts -->
                                            <div class="btn-group pull-right">
                                                <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                                                    <i class="icon-user"></i><span class="hidden-phone"> Conta</span>
                                                    <span class="caret"></span>
                                                </a>
                                                <ul class="dropdown-menu">
                                                    <li><a href="index.html">Sair</a></li>
                                                </ul>
                                            </div>
                                            <!-- user dropdown ends -->
                                            <!-- Usuarios -->
                                            <div class="btn-group pull-right">
                                                <ul class="dropdown-menu">
                                                    <li><a class="btn-setting">Cadastrar</a></li>
                                                </ul>
                                            </div>
                                            <!-- End Usuarios -->
                                        </div>
                                    </div>
                                </div>
                                <!-- topbar ends -->
                                <div class="container-fluid">
                                    <div class="row-fluid">

                                        <!-- left menu starts -->
                                        <div class="span2 main-menu-span">
                                            <div class="well nav-collapse sidebar-nav">
                                                <ul class="nav nav-tabs nav-stacked main-menu">
                                                    <li class="nav-header hidden-tablet">Menu Principal</li>
                                                    <li><a class="ajax-link" href="secretariaProcesso.html"><i
                                                                class="icon-list-alt"></i><span class="hidden-tablet">
                                                                Processos</span></a></li>
                                                    <li><a class="ajax-link" href="secretariaCliente.html"><i
                                                                class="icon-user"></i><span class="hidden-tablet">
                                                                Clientes</span></a></li>
                                                </ul>
                                            </div>
                                            <!--/.well -->
                                        </div>
                                        <!--/span-->
                                        <!--/span-->
                                        <!-- left menu ends -->

                                        <div id="content" class="span10">
                                            <!-- content starts -->
                                            <!-- content starts -->
                                            <div class="sortable row-fluid">
                        <a data-rel="tooltip" title="advogados cadastrados"
                           class="well span3 top-block" href="#"> <span
                                class="icon32 icon-red icon-user"></span>
                            <div>Advogados no escrit&oacute;rio</div>
                            <span class="notification" id="notification-advogados-escritorio"></span>
                        </a> <a data-rel="tooltip" title="Secretarias(os)"
                                class="well span3 top-block" href="#"> <span
                                class="icon32 icon-color icon-star-on"></span>
                            <div>Secret&aacute;rias(os) no escrit&oacute;rio</div>
                             <span class="notification green" id="notication-total-secretarias-escritorio"></span>
                        </a> <a data-rel="tooltip"
                                title="clientes com processos no escrit&oacute;rio"
                                class="well span3 top-block" href="#"> <span
                                class="icon32 icon-color icon-home"></span>
                            <div>Clientes</div>
                            <span class="notification yellow" id="notication-total-clientes-escritorio"></span>
                        </a> <a data-rel="tooltip" title="Processos cadastrados"
                                class="well span3 top-block" href="#"> <span
                                class="icon32 icon-color icon-book"></span>
                            <div>Processos Cadastrados</div>
                            <span class="notification red" id="notication-total-processos-escritorio"></span>
                        </a>
                    </div>
                                            <div class="row-fluid sortable">
                                                <div class="box span12">
                                                    <div class="box-header well" data-original-title>
                                                        <h2>
                                                            <i class="icon-user"></i>Clientes
                                                        </h2>
                                                        <div class="box-icon">
                                                            <a href="#" class="btn btn-minimize btn-round"><i
                                                                    class="icon-chevron-up"></i></a>
                                                        </div>
                                                    </div>
                                                    <div id="div_tb_clientes" class="box-content">
                                                        <button type="button" class="btn btn-info btn-setting"
                                                                style="width: 10%">Cadastrar Cliente</button>
                                                        <br /> <br />
                                                        <table id="tb_clientes"></table>
                                                        <div id="pager_tb_clientes"></div>
                                                        <input type="button" id="bsdata" value="Filtrar" />
                                                        <input type="button" id="btnExportExcel" value="Exportar Excel"
                                                               onclick="exportExcel()" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <hr>
                                        <!-- Caixas de confirmação para deleção -->
                                        <div class="modal hide fade" id="confirm-delete"
                                             style="width: 256px; left: 60%;">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal">×</button>
                                                <h3>Exclusão de Cliente</h3>
                                            </div>
                                            <div class="modal-body">
                                                <p>Deseja excluir este cliente</p>
                                            </div>
                                            <div class="modal-footer">
                                                <a href="#" class="btn btn-success" data-dismiss="modal"> <i
                                                        class="icon icon-white icon-close"></i> Não
                                                </a> <a href="#" class="btn btn-danger" data-dismiss="modal"
                                                        onclick='deleteUser(deleteUserID)'> <i
                                                        class="icon icon-white icon-trash"></i> Sim
                                                </a>
                                            </div>
                                        </div>
                                        <div class="modal hide fade" id="myModal">
                                            <div class="modal-body" style="min-height: 0px">
                                                <div class="row-fluid sortable">
                                                    <div class="box-content">
                                                        <form class="form-horizontal" name="formCadastro">
                                                            <fieldset>
                                                                <input type="hidden" id="csvBuffer"
                                                                     name="csvBuffer" />
                                                                <div class="control-group">
                                                                    <label class="control-label" for="nomeCliente">Nome</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="nomeCliente"
                                                                               maxlength="50" type="text">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="enderecoCliente">Endere&ccedil;o</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused"
                                                                               id="enderecoCliente" maxlength="50" type="text">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="cidadeCliente">Cidade</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused"
                                                                               id="cidadeCliente" maxlength="50" type="text">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="estadoCliente">Estado</label>
                                                                    <div class="controls">
                                                                        <select id="estadoCliente" data-rel="chosen">
                                                                            <option>AC</option>
                                                                            <option>AL</option>
                                                                            <option>AM</option>
                                                                            <option>AP</option>
                                                                            <option>BA</option>
                                                                            <option>CE</option>
                                                                            <option>DF</option>
                                                                            <option>ES</option>
                                                                            <option>GO</option>
                                                                            <option>MA</option>
                                                                            <option>MG</option>
                                                                            <option>MS</option>
                                                                            <option>MT</option>
                                                                            <option>PA</option>
                                                                            <option>PB</option>
                                                                            <option>PE</option>
                                                                            <option>PI</option>
                                                                            <option>PR</option>
                                                                            <option>RJ</option>
                                                                            <option>RN</option>
                                                                            <option>RO</option>
                                                                            <option>RR</option>
                                                                            <option>RS</option>
                                                                            <option>SC</option>
                                                                            <option>SE</option>
                                                                            <option>SP</option>
                                                                            <option>TO</option>
                                                                        </select>
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="cepCliente">CEP</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="cepCliente"
                                                                               onkeypress="validaCampos(this,cep)" maxlength="9" type="text">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="telefoneCliente">Telefone
                                                                        (fixo)</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="telefoneCliente"
                                                                               onkeypress="validaCampos(this,telefone)" maxlength="14"
                                                                               type="text">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="telefoneMovelCliente">Telefone
                                                                        (m&oacute;vel)</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="telefoneMovelCliente"
                                                                               onkeypress="validaCampos(this,telefone)" maxlength="15"
                                                                               type="text">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="emailCliente">E-mail</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="emailCliente"
                                                                               onBlur="trim(formCadastro.emailUsuario); validaEmail(formCadastro.emailUsuario)"
                                                                               maxlength="50" type="text">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="dtNascCliente">Data de
                                                                        nascimento</label>
                                                                    <div class="controls">
                                                                        <input type="text" class="input-xlarge datepicker"
                                                                               id="dtNascCliente">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="cpfCliente">CPF</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="cpfCliente"
                                                                               onkeypress="validaCampos(this,cpf)" maxlength="14"
                                                                               type="text">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="rgCliente">RG</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="rgCliente" type="text"
                                                                               maxlength="12">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="profissaoCliente">Profiss&atilde;o</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="profissaoCliente" type="text"
                                                                               maxlength="12">
                                                                    </div>
                                                                </div>
                                                                <div class="control-group">
                                                                    <label class="control-label" for="estadoCivilCliente">Estado Civil</label>
                                                                    <div class="controls">
                                                                        <input class="input-xlarge focused" id="estadoCivilCliente" type="text"
                                                                               maxlength="12">
                                                                    </div>
                                                                </div>
                                                            </fieldset>
                                                        </form>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="modal-footer">
                                                <a href="#" class="btn" data-dismiss="modal">Fechar</a> <a href="#"
                                                                                                           class="btn btn-primary" onclick="return submitCadastroCliente();">Cadastrar</a>
                                            </div>
                                        </div>
                                        <div class="modal hide fade" id="confirm-block"
                                             style="width: 256px; left: 60%;">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal">×</button>
                                                <h3>Bloqueio de escritório</h3>
                                            </div>
                                            <div class="modal-body">
                                                <p>Deseja bloquear este escritório?</p>
                                            </div>
                                            <div class="modal-footer">
                                                <a href="#" class="btn btn-success" data-dismiss="modal"> <i
                                                        class="icon icon-white icon-close"></i> Não
                                                </a> <a href="#" class="btn btn-danger" data-dismiss="modal"> <i
                                                        class="icon-lock icon-white"></i> Sim
                                                </a>
                                            </div>
                                        </div>
                                        <!-- Fim das caixas -->
                                        <footer>
                                            <p class="pull-left">
                                                &copy; <a href="#" target="_blank">Bacharel 6º Ciclo FATEC
                                                    Carapicuíba</a> 2012
                                            </p>
                                        </footer>

                                </div>
                                <!--/.fluid-container-->
                                <!-- Formulário de edição de usuário
                                                                        Melhora: Passar página para .php e usar include evitando repetir este código em todas as páginas
                                -->
                                <div class="modal hide fade" id="edit-user">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal">×</button>
                                        <h3>Editar gerente</h3>
                                    </div>
                                    <div class="modal-body" style="min-height: 0px">
                                        <div class="row-fluid sortable">
                                            <div class="box-content">
                                                <form class="form-horizontal" name="formUpdate">
                                                    <fieldset>

                                                        <div class="control-group">
                                                            <label class="control-label" for="estadoUsuario">Estado</label>
                                                            <div class="controls">
                                                                <select id="estadoUsuario">
                                                                    <option>AC</option>
                                                                    <option>AL</option>
                                                                    <option>AM</option>
                                                                    <option>AP</option>
                                                                    <option>BA</option>
                                                                    <option>CE</option>
                                                                    <option>DF</option>
                                                                    <option>ES</option>
                                                                    <option>GO</option>
                                                                    <option>MA</option>
                                                                    <option>MG</option>
                                                                    <option>MS</option>
                                                                    <option>MT</option>
                                                                    <option>PA</option>
                                                                    <option>PB</option>
                                                                    <option>PE</option>
                                                                    <option>PI</option>
                                                                    <option>PR</option>
                                                                    <option>RJ</option>
                                                                    <option>RN</option>
                                                                    <option>RO</option>
                                                                    <option>RR</option>
                                                                    <option>RS</option>
                                                                    <option>SC</option>
                                                                    <option>SE</option>
                                                                    <option>SP</option>
                                                                    <option>TO</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="nomeUsuario">Nome
                                                                completo</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="nomeUsuario"
                                                                       maxlength="50" type="text" value="X"
                                                                       onBlur="trim(formUpdate.nomeUsuario)">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="enderecoUsuario">Endereço</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="enderecoUsuario"
                                                                       onBlur="trim(formUpdate.enderecoUsuario)" maxlength="80"
                                                                       type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="cidadeUsuario">Cidade</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="cidadeUsuario"
                                                                       onBlur="trim(formUpdate.cidadeUsuario)" maxlength="35"
                                                                       type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="cepUsuario">CEP</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="cepUsuario"
                                                                       onkeypress="validaCampos(this,cep)" maxlength="9" type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="telefoneUsuario">Telefone
                                                                (fixo)</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="telefoneUsuario"
                                                                       onkeypress="validaCampos(this,telefone)" maxlength="14"
                                                                       type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="telefoneMovelUsuario">Telefone
                                                                (móvel)</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="telefoneMovelUsuario"
                                                                       onkeypress="validaCampos(this,telefone)" maxlength="15"
                                                                       type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="emailUsuario">E-mail</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="emailUsuario"
                                                                       onBlur="trim(formCadastro.emailUsuario); validaEmail(formCadastro.emailUsuario)"
                                                                       maxlength="50" type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="dtNascUsuario">Data de
                                                                nascimento</label>
                                                            <div class="controls">
                                                                <input type="text" class="input-xlarge datepicker"
                                                                       id="dtNascUsuario">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="cpfUsuario">Profiss&atilde;o</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="profissaoUsuario"
                                                                       type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="cpfUsuario">Estado
                                                                Civil</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="estadoCivilUsuario"
                                                                       type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="cpfUsuario">CPF</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="cpfUsuario"
                                                                       onkeypress="validaCampos(this,cpf)"
                                                                       onBlur="validarCPF(formCadastro.cpfUsuario)" maxlength="14"
                                                                       type="text">
                                                            </div>
                                                        </div>
                                                        <div class="control-group">
                                                            <label class="control-label" for="rgUsuario">RG</label>
                                                            <div class="controls">
                                                                <input class="input-xlarge focused" id="rgUsuario" type="text"
                                                                       maxlength="9">
                                                            </div>
                                                        </div>
                                                    </fieldset>
                                                </form>
                                            </div>
                                        </div>
                                        <!--/row-->
                                    </div>
                                    <div class="modal-footer">
                                        <a href="#" class="btn" data-dismiss="modal">Cancelar</a> <a href="#"
                                                                                                     class="btn btn-primary" data-dismiss="modal"
                                                                                                     onclick="updateUser(updateUserId)">Atualizar</a>
                                    </div>
                                </div>
                                <!-- Formulário de edição de usuário -->

                                <!-- external javascript
                                                        ================================================== -->
                                <!-- Placed at the end of the document so the pages load faster -->

                                <!-- jQuery -->
                                <script src="js/jquery-1.7.2.min.js"></script>
                                <!-- jQuery UI -->
                                <script src="js/jquery-ui-1.8.21.custom.min.js"></script>
                                <!-- transition / effect library -->
                                <script src="js/bootstrap-transition.js"></script>
                                <!-- alert enhancer library -->
                                <script src="js/bootstrap-alert.js"></script>
                                <!-- modal / dialog library -->
                                <script src="js/bootstrap-modal.js"></script>
                                <!-- custom dropdown library -->
                                <script src="js/bootstrap-dropdown.js"></script>
                                <!-- scrolspy library -->
                                <script src="js/bootstrap-scrollspy.js"></script>
                                <!-- library for creating tabs -->
                                <script src="js/bootstrap-tab.js"></script>
                                <!-- library for advanced tooltip -->
                                <script src="js/bootstrap-tooltip.js"></script>
                                <!-- popover effect library -->
                                <script src="js/bootstrap-popover.js"></script>
                                <!-- button enhancer library -->
                                <script src="js/bootstrap-button.js"></script>
                                <!-- accordion library (optional, not used in demo) -->
                                <script src="js/bootstrap-collapse.js"></script>
                                <!-- carousel slideshow library (optional, not used in demo) -->
                                <script src="js/bootstrap-carousel.js"></script>
                                <!-- autocomplete library -->
                                <script src="js/bootstrap-typeahead.js"></script>
                                <!-- tour library -->
                                <script src="js/bootstrap-tour.js"></script>
                                <!-- library for cookie management -->
                                <script src="js/jquery.cookie.js"></script>
                                <!-- calander plugin -->
                                <script src='js/fullcalendar.js'></script>
                                <!-- data table plugin -->
                                <script src='js/jquery.dataTables.min.js'></script>

                                <!-- chart libraries start -->
                                <script src="js/excanvas.js"></script>
                                <script src="js/jquery.flot.min.js"></script>
                                <script src="js/jquery.flot.pie.min.js"></script>
                                <script src="js/jquery.flot.stack.js"></script>
                                <script src="js/jquery.flot.resize.min.js"></script>
                                <!-- chart libraries end -->

                                <!-- select or dropdown enhancer -->
                                <script src="js/jquery.chosen.min.js"></script>
                                <!-- checkbox, radio, and file input styler -->
                                <script src="js/jquery.uniform.min.js"></script>
                                <!-- plugin for gallery image view -->
                                <script src="js/jquery.colorbox.min.js"></script>
                                <!-- rich text editor library -->
                                <script src="js/jquery.cleditor.min.js"></script>
                                <!-- notification plugin -->
                                <script src="js/jquery.noty.js"></script>
                                <!-- file manager library -->
                                <script src="js/jquery.elfinder.min.js"></script>
                                <!-- star rating plugin -->
                                <script src="js/jquery.raty.min.js"></script>
                                <!-- for iOS style toggle switch -->
                                <script src="js/jquery.iphone.toggle.js"></script>
                                <!-- autogrowing textarea plugin -->
                                <script src="js/jquery.autogrow-textarea.js"></script>
                                <!-- multiple file upload plugin -->
                                <script src="js/jquery.uploadify-3.1.min.js"></script>
                                <!-- history.js for cross-browser state change on ajax -->
                                <script src="js/jquery.history.js"></script>
                                <!-- application script for Charisma demo -->
                                <script src="js/charisma.js"></script>
                                <script src="js/jquery.validaCampos.js"></script>
                                <!-- jqGrid -->
                                <script src="jqGrid/js/i18n/grid.locale-pt-br.js"
                                type="text/javascript"></script>
                                <script src="jqGrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
                                <script src="js/jquery.ui.datepicker-pt-BR.js"></script>
                                <script src="js/cadastro-usuario.js"></script>
                                <script type="text/javascript">
		$(function() {
			jQuery.get('../index.php?notificacao/totalAdvogadosEscritorio', {}, function(ret) {
				document.getElementById('notification-advogados-escritorio').innerHTML = ret;
			}, "html");
			jQuery.get('../index.php?notificacao/totalSecretariasEscritorio',{},function(ret) {
				document.getElementById('notication-total-secretarias-escritorio').innerHTML = ret;
			}, "html");
			jQuery.get('../index.php?notificacao/totalClientesEscritorio',{},function(ret) {
				document.getElementById('notication-total-clientes-escritorio').innerHTML = ret;
			}, "html");
			jQuery.get('../index.php?notificacao/totalProcessosEscritorio',{},function(ret) {
				document.getElementById('notication-total-processos-escritorio').innerHTML = ret;
			}, "html");
			jQuery.get('../index.php?notificacao/getCodigoEscritorio',{},function(ret) {
				document.getElementById('notification-code-escritorio').innerHTML = "escrit&oacute;rio : " + ret;
			}, "html");
			jQuery.get('../index.php?notificacao/getCodigoGerente',{},function(ret) {
				document.getElementById('notification-code-gerente').innerHTML = "C&oacute;digo de gerente : " + ret;
			}, "html");
			
		});
	</script>
                                <script type="text/javascript">				// Url usada para deletar os usuários
                                    var deleteURL = "../index.php?cliente/removerCliente";
                                    // Url usada para atualizar dados do usuário
                                    var updateURL = "../index.php?cliente/atualizarCliente";
                                    // Url usada para adquirir lista de usuários (gerentes -> type=2)
                                    var listUser = "../index.php?cliente/listAllByEscritorio";
                                    // Url que traz todos os dados do usuário para exibição no form de edição
                                    var getUserDataURL = "../index.php?cliente/getCliente";
				
				
                                    var ativarStatusUserURL = "../index.php?cliente/ativarCliente";
				
                                    var inativarStatusUserURL = "../index.php?cliente/inativarCliente";
                                    <!-------------------------------------------------------------------->

                                    // Id do usuário usado para deleção
                                    var deleteUserID = -1;
                                    // Id do usuário usado para atualização
                                    var updateUserId = -1;
                                </script>
                                <script type="text/javascript">
                                    $(function() {
                                        $.datepicker.setDefaults($.datepicker.regional["pt-BR"]);
                                    });
                                </script>
                                <!-- Tabela jqGrid -->
                                <script type="text/javascript">
                                    $(document).ready(function(){
                                        $("#tb_clientes").jqGrid({
                                            url:listUser,
                                            height: 210,
                                            datatype:"json",
                                            colNames: ["id", "Nome", "Endereço", "Cidade", "Estado", "CEP", "Telefone" , "Celular", "Email", "Data de Nascimento", "Profissão", "Estado Civil", "RG", "CPF", "Status", "Ações"],
                                            colModel: [
                                                {name:"id", hidden:true, key: true},
                                                {name:"nome", resizeable:true, sortable: true, width: 80},
                                                {name:"endereco", resizeable:true, sortable: true, width: 80},
                                                {name:"cidade", resizeable:true, sortable: true,width: 80},
                                                {name:"estado", resizeable:true, sortable: true, width: 80},
                                                {name:"cep", resizeable:true, sortable: true, width: 100},
                                                {name:"telefone_fixo", resizeable:true, sortable: true, width: 100},
                                                {name:"telefone_movel", resizeable:true, sortable: true, width:80},
                                                {name:"email", resizeable:true, sortable: true, width:30},
                                                {name:"data_nascimento", resizeable:true, sortable: true, width:70},
                                                {name:"profissao", resizeable:true, sortable: true, width:90},
                                                {name:"estado_civil", resizeable:true, sortable: true, width:60},
                                                {name:"rg", resizeable:true, sortable: true, width:60},
                                                {name:"cpf", resizeable:true, sortable: true, width:60},
                                                {name:"status", resizeable:true, sortable: true, width:60},
                                                {name:"acoes", resizeable:false, sortable: false, width:80}
                                            ],
                                            autowidth:true,
                                            rowNum: 10,
                                            gridComplete: function(){ 
                                                var ids = $("#tb_clientes").getDataIDs(); // Pega os IDs das linhas
                                                for(var i=0;i<ids.length;i++){
                                                    // Pega id do usuário
                                                    // alert($("#tb_clientes").jqGrid('getRowData', ids[i]).id);
                                                    // Modifica o campo acoes de todas as linhas inserindo os botões customizados
                                                    $("#tb_clientes").jqGrid('setRowData',ids[i],{acoes:"<!--<a  class='btn btn-success' title='Bloquear' href='#' onclick=''><i class='icon-lock icon-white'></i></a>--><a title='Editar' class='btn btn-info' href='#' onclick=showUpdateForm("+ids[i]+")><i class='icon-edit icon-white'></i></a><a title='Remover' class='btn btn-danger' href='#' onclick=showConfirmDelete("+ids[i]+")><i class='icon-trash icon-white'></i></a>"});
                                                    // Modifica os campos de texto com ativo/inativo
                                                    if(parseInt($("#tb_clientes").jqGrid('getRowData', ids[i]).status) == 1)
                                                        $("#tb_clientes").jqGrid('setRowData', ids[i], {status:"<span class='label label-success'  onclick='inativarStatusUser("+ids[i]+")' >Ativo</span>"});
                                                    else
                                                        $("#tb_clientes").jqGrid('setRowData', ids[i], {status:"<span class='label label-warning' onclick='ativarStatusUser("+ids[i]+")'>Inativo</span>"});
                                                } 
                                            },
                                            //multiselect: true, // Também podemos tirar os botões de cada linha e utilizar um sistema de multiseleção e usar apenas três botões
                                            pager:$("#pager_tb_clientes")
                                        }).navGrid("#pagerTbClientes", {edit:false, add:false, del:false});
                                    });
                                    $(window).resize(function(){
                                        var width = document.getElementById("div_tb_clientes").offsetWidth;
                                        $("#tb_clientes").setGridWidth(width-20);
                                    });
                                    $("#bsdata").click(function(){
                                        jQuery("#tb_clientes").jqGrid('searchGrid',
                                        {sopt:['cn','eq'],width:800}
                                    );
                                    });
                                    
                                    function ativarStatusUser(id){
                                        jQuery.get(ativarStatusUserURL, {id_cliente:id+""}, function(ret){}, "html");	
                                        $("#tb_clientes").trigger('reloadGrid');
                                    }
			
                                    function inativarStatusUser(id){
                                        jQuery.get(inativarStatusUserURL, {id_cliente:id+""}, function(ret){}, "html");	
                                        console.info (inativarStatusUserURL);
				
                                        $("#tb_clientes").trigger('reloadGrid');
                                    }
			
			
                                    function showConfirmDelete(id) {
                                        deleteUserID = id;
                                        $("#confirm-delete").modal('show');
                                    }
                                    function showUpdateForm(userId) {
                                        updateUserId = userId;

                                        jQuery.get(getUserDataURL, {id:userId}, function(ret){
                                            /**
                                                                                                $row['id_cliente'],
                                                                                                $row['nome'],
                                                                                                $row['endereco'],
                                                                                                $row['cidade'],
                                                                                                $row['estado'],
                                                                                                $row['cep'],
                                                                                                $row['telefone_fixo'],
                                                                                                $row['telefone_movel'],
                                                                                                $row['email'],
                                                                                                $row['data_nascimento'],
                                                                                                $row['profissao'],
                                                                                                $row['estado_civil'],
                                                                                                $row['rg'],
                                                                                                $row['cpf'],
                                                                                                $row['status']
                                             */
                                            document.getElementById('nomeUsuario').value = ret[1];
                                            document.getElementById('enderecoUsuario').value = ret[2];
                                            document.getElementById('cidadeUsuario').value = ret[3];
                                            document.getElementById('cepUsuario').value = ret[5];
                                            document.getElementById('telefoneUsuario').value = ret[6];
                                            document.getElementById('telefoneMovelUsuario').value = ret[7];
                                            document.getElementById('emailUsuario').value = ret[8];
                                            document.getElementById('dtNascUsuario').value = ret[9];
                                            document.getElementById('profissaoUsuario').value = ret[10];
                                            document.getElementById('estadoCivilUsuario').value = ret[11];
                                            var sel = document.getElementById('estadoUsuario');
                                            for(i = 0; i < sel.length; i++) {
                                                if(sel.options[i].value == ret[5]) {
                                                    sel.selectedIndex = i; // data-rel chosen de estadoUsuario removido para isto funcionar
                                                    break;
                                                }
                                            }
                                            document.getElementById('rgUsuario').value = ret[12];
                                            document.getElementById('cpfUsuario').value = ret[13];
                                            $("#edit-user").modal('show');
                                        },
                                        "json");
                                    }
                                    function updateUser(userId) {
                                        jQuery.get(updateURL, {
                                            id_usuario:userId+"",
                                            nome:document.getElementById('nomeUsuario').value,
                                            endereco:document.getElementById('enderecoUsuario').value,
                                            cidade:document.getElementById('cidadeUsuario').value,
                                            cep:document.getElementById('cepUsuario').value,
                                            telefone_fixo:document.getElementById('telefoneUsuario').value,
                                            telefone_movel:document.getElementById('telefoneMovelUsuario').value,
                                            email:document.getElementById('emailUsuario').value,
                                            rg:document.getElementById('rgUsuario').value,
                                            cpf:document.getElementById('cpfUsuario').value,
                                            data_nascimento:document.getElementById('dtNascUsuario').value,
                                            estado:document.getElementById('estadoUsuario').options[document.getElementById('estadoUsuario').selectedIndex].value
                                        }, function(ret){}, "html");
                                        $("#tb_clientes").trigger('reloadGrid');
                                    }
                                    function deleteUser(userId) {
                                        jQuery.get(deleteURL, {id:userId+""}, function(ret){}, "html");
                                        $("#tb_clientes").trigger('reloadGrid');
                                    }
                                    
                                    function exportExcel()
                                        {
                                            var mya=new Array();
                                            mya=$("#tb_clientes").getDataIDs();  // Get All IDs
                                            var data=$("#tb_clientes").getRowData(mya[0]);     // Get First row to get the labels
                                            var colNames=new Array(); 
                                            var ii=0;
                                            for (var i in data){
                                                colNames[ii++]=i;
                                            }    // capture col names
                                            var html="";
	                
                                            for(i=0;i<mya.length;i++){
                                                data=$("#tb_clientes").getRowData(mya[i]); // get each row
                                                for(j=0;j<colNames.length;j++)
                                                {
                                                
                                                    if (colNames[j] == "status"){
                                                        console.info (data[colNames[j]]);
                                                        if (data[colNames[j]].indexOf("Ativo") !== -1){
                                                            html=html + " ativo " + "\t";    
                                                        }else{
                                                            html=html + " inativo " + "\t";  
                                                        }
                                                    }else if (colNames[j] == "acoes"){
                                                        html=html + " " + "\t"; 	
                                                    }else{
                                                        html=html+data[colNames[j]]+"\t"; 
                                                    }
                                                }
                                                html=html+"\n"; 
                                            }
                                            console.info(html);
                                        
                                            document.forms[0].csvBuffer.value=html;
                                            document.forms[0].method='POST';
                                            document.forms[0].action='../controllers/exportExcel.php'; 
                                            document.forms[0].target='_blank';
                                            document.forms[0].submit();
                                        }
                                    function submitCadastroCliente() {
                                        isValid = 1;
                                        
                                        var nomeCliente = document.getElementById('nomeCliente');
                                        var enderecoCliente = document.getElementById('enderecoCliente');
                                        var cidadeCliente = document.getElementById('cidadeCliente');
                                        var estadoCliente = document.getElementById('estadoCliente');
                                        var cepCliente = document.getElementById('cepCliente');
                                        var emailCliente = document.getElementById('emailCliente');
                                        var telefoneCliente = document.getElementById('telefoneCliente');
                                        var telefoneMovelCliente = document.getElementById('telefoneMovelCliente');
                                        var dtNascCliente = document.getElementById('dtNascCliente');
                                        var profissaoCliente = document.getElementById('profissaoCliente');
                                        var estadoCivilCliente = document.getElementById('estadoCivilCliente');
                                        var rgCliente = document.getElementById('rgCliente');
                                        var cpfCliente = document.getElementById('cpfCliente');
                                        
                                        isEmpty(nomeCliente);
                                        isEmpty(enderecoCliente);
                                        isEmpty(cidadeCliente);
                                        isEmpty(cepCliente);
                                        isEmpty(telefoneCliente);
                                        isEmpty(telefoneMovelCliente);
                                        isEmpty(dtNascCliente);
                                        isEmpty(profissaoCliente);
                                        isEmpty(estadoCivilCliente);
                                        isEmpty(rgCliente);
                                        isEmpty(cpfCliente);
                                        
                                        if (!isValid)
                                            return false;
                                        var urlCadastro = "../index.php?cliente/salvar&nome="
                                            + nomeCliente.value
                                            + "&endereco="
                                            + enderecoCliente.value
                                            + "&cidade="
                                            + cidadeCliente.value
                                            + "&estado="
                                            + estadoCliente.value
                                            + "&cep="
                                            + cepCliente.value
                                            + "&telefone_fixo="
                                            + telefoneCliente.value
                                            + "&telefone_movel="
                                            + telefoneMovelCliente.value
                                            + "&email="
                                            + emailCliente.value
                                            + "&data_nascimento="
                                            + dtNascCliente.value
                                            + "&profissao="
                                            + profissaoCliente.value
                                            + "&estado_civil="
                                            + estadoCivilCliente.value
                                            + "&rg="
                                            + rgCliente.value
                                            + "&cpf="
                                            + cpfCliente.value
                                            + "&profissao="
                                            + profissaoCliente.value
                                        alert(urlCadastro)
                                        $.ajax({
                                            url : urlCadastro,
                                            success : function(result) {
                                                var key = parseInt(result.replace(']', '').replace('[',
                                                ''));
                                                switch (key) {
                                                    case 0:
                                                        window
                                                        .alert("Erro ao cliente processo. Entre em contato com o administrador do sistema.");
                                                        break;
                                                    case 1:
                                                        window
                                                        .alert("Processo cliente com sucesso.");
                                                        break;
                                                    default:
                                                        window
                                                        .alert("Erro ao cliente processo. Entre em contato com o administrador do sistema.");
                                                        break;
                                                }
                                            },
                                            error : function(request, status, errorThrown) {
                                                alert("Erro ao cadastrar cliente. Entre em contato com o administrador do sistema.");
                                            }
                                        });
                                    }
                                </script>
                            </body>
                            </html>
